package com.codeoss.module.product.service.impl;

import java.util.List;

import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.codeoss.framework.service.impl.BaseService;
import com.codeoss.module.product.dao.ProductAttributeInstanceMapper;
import com.codeoss.module.product.model.ProductAttributeInstance;
import com.codeoss.module.product.service.IProductAttributeInstanceService;

@Service
public class ProductAttributeInstanceService
		extends BaseService<ProductAttributeInstanceMapper, ProductAttributeInstance>
		implements IProductAttributeInstanceService {

	@Override
	public List<ProductAttributeInstance> getAttributeInstanceListByAttributeSetInstanceId(
			Long productAttributeSetInstanceId) {
		// TODO Auto-generated method stub
		QueryWrapper<ProductAttributeInstance> query=new QueryWrapper<ProductAttributeInstance>();
		query.eq("product_attribute_set_instance_id", productAttributeSetInstanceId);
		return list(query);
	}

	@Override
	public ProductAttributeInstance getAttributeInstanceByAttributeIdAndAttributeSetInstanceId(Long attributeId,
			Long attributeSetInstanceId) {
		// TODO Auto-generated method stub
		QueryWrapper<ProductAttributeInstance> query=new QueryWrapper<ProductAttributeInstance>();
		query.eq("product_attribute_set_instance_id", attributeSetInstanceId);
		query.eq("product_attribute_id", attributeId);
		return getOne(query);
	}
}